﻿using System;
using System.Collections.Generic;

namespace NapazEngine.Utilities.Data
{
    public class GameLog
    {
        private List<String> log;

        public GameLog()
        {
            log = new List<string>();
        }

        public void Add(String message)
        {
            log.Add(message);

            Setting s = Global.Settings.GetClientSetting("printLog");
            if ((bool)(s.Value) == true)
                Console.WriteLine(message);
        }

        public List<String> Log
        {
            get { return log; }
        }

        public List<String> getLastNumItems(int num)
        {
            List<String> newLog = new List<string>();
            for (int i = log.Capacity; i > log.Capacity - num; i--)
            {
                newLog.Add(log[i]);
            }
            return newLog;
        }
    }
}
